package com.solveit.aps.io.db;

import com.solveit.core.controller.Command;
import com.solveit.core.ui.UIUtil;

/**
 * Created by IntelliJ IDEA.
 * User: aadajeniuc
 * Date: 14/09/11
 * Time: 13:08
 * To change this template use File | Settings | File Templates.
 */
public class LoadSolutionComponent {
    public LoadSolutionComponent() {
        Command cmd = new Command() {
            @Override
            public void execute() throws Exception {
//                int liveScenarioId = IntegratedScenario.selectLiveScenarioStub().getId();
////                for (IntegratedScenario item : ScenarioContainer.getInstance().loadIntegratedScenarioStubs()) {
////                    if (item.isLive()) {
////                        liveScenarioId = item.getId();
////                        break;
////                    }
////                }
//                int lastOpenedScenarioId = UserSettingsComponent.getInstance().getUserDataRepository().getDataInt(UserSettingsComponent.LAST_OPENED_SCENARIO, true, liveScenarioId, false);
//                // mlock 10112011 --> Now defaults to true
//                if (UserSettingsComponent.getInstance().getUserDataRepository().getDataBoolean(UserSettingsComponent.LOAD_LAST_OPENED_SCENARIO, true, true, false)) {
//                    new LoadScenarioAction().execute(lastOpenedScenarioId, true, true);
//                } else {
//                    new LoadScenarioAction().execute(liveScenarioId, true, true);
//                }
            }
        };
        UIUtil.startCommandOnSeparateThread(cmd, "Loading Integrated Scenario...");
    }
}
